/**
 * Created with IntelliJ IDEA.
 * User: user
 * Date: 15.11.13
 * Time: 13:55
 * To change this template use File | Settings | File Templates.
 */

import arina.university.controller.GroupController;
import arina.university.controller.UniversityController;
import arina.university.model.Group;
import arina.university.model.Student;
import arina.university.controller.StudentController;
import arina.university.model.University;
import arina.university.view.GroupView;
import arina.university.view.StudentView;
import arina.university.view.UniversityView;

public class Main {
    public static void main(String[] args) {
        StudentView view = new StudentView();
        StudentController controller = new StudentController(view);
        Student arina = controller.createStudent("arina", 123, "01.09.2010");
        Student ololo=controller.createStudent("ololo",124,"01.09.2011");

        System.out.println("arina & ololo have beed added:");
        controller.findAllStudents();

        System.out.println("arina has been updated, ololo has been removed, remove() was called for nonexistent student");
        controller.updateStudent(arina.getId(), "Arina Stadnikova", 123, "01.09.2010");
        controller.removeStudent(124);
        controller.removeStudent(125);
        controller.findAllStudents();

        System.out.println("arina has been found, findStudent has been called for nonexistent student: ");
        controller.findStudent(arina.getId());
        controller.findStudent(128);

        System.out.println("another student with id=123 has been added");
        controller.createStudent("ololo", 123, "01.09.2011");
        controller.findAllStudents();

        System.out.println("-------------------------------------------------------------------------------------");

        GroupView groupView = new GroupView();
        GroupController groupController = new GroupController(groupView);

        Group group1 = groupController.createGroup(412, "Applied Mathematics and Computer Science");
        Group group2 = groupController.createGroup(441, "Applied Mathematics and Economics");
        groupController.addStudent(group1.getNumber(),arina);

        System.out.println("groups 412 & 441 have been added, arina has been added to group 412");
        groupController.findAllGroups();

        System.out.println("another group with id 412 has been added");
        groupController.createGroup(412, "ololo");
        groupController.findAllGroups();


        System.out.println("--------------------------------------------------------------");
        UniversityView universityView = new UniversityView();
        UniversityController universityController = new UniversityController(universityView);
        University sgu = universityController.createUniversity("Saratov State University");
        universityController.addGroup(sgu.getName(), group1);
        universityController.addGroup(sgu.getName(),group2);
        universityController.findAllUniversities();


    }
}
